package cn.com.qtgl.userfilters.model.pojo;

import cn.com.qtgl.userfilters.model.enums.UserFilterType;
import lombok.Data;
import lombok.Getter;

import java.util.Objects;

@Getter
public class UserFilter<TRIPLE extends Triple> {

    public UserFilter(UserFilterType userFilterType, TRIPLE triple) {
        this.userFilterType = userFilterType;
        this.triple = triple;
    }

    private final UserFilterType userFilterType;

    private final TRIPLE triple;

    public String getBody(){
        return this.triple.getBody();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof UserFilter<?> that)) return false;
        return Objects.equals(getBody(), that.getBody());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getBody());
    }

    @Override
    public String toString() {
        return getBody();
    }
}
